const express = require('express');

const app = express();

app.set('secret', 'ds4a5fgdsqwqw849');

// 全局中间件
app.use(require('cors')());
app.use(express.json());
// 静态资源访问
app.use('/admin', express.static(__dirname + '/admin'))
app.use('/', express.static(__dirname + '/web'))
app.use('/uploads', express.static(__dirname + '/uploads'))

require('./plugins/db')(app);

require('./route/admin')(app);

require('./route/web')(app);

app.listen(3000, () => {
    console.log('http://localhost:3000');
});
